const p = document.querySelector('.right p')
const span = document.querySelector('.right span')
const strong = document.querySelector('.right strong')
let d = new Date();
window.onload = function () {
    switch (d.getDay()) {
        case 1: span.innerHTML = "星期一"; break;
        case 2: span.innerHTML = "星期二"; break;
        case 3: span.innerHTML = "星期三"; break;
        case 4: span.innerHTML = "星期四"; break;
        case 5: span.innerHTML = "星期五"; break;
        case 6: span.innerHTML = "星期六"; break;
        case 0: span.innerHTML = "星期日"; break;
    }
    p.innerHTML = add(d.getDate());
    strong.innerHTML = d.getFullYear() + "." + add(d.getMonth() + 1);


    function add(n) {
        return (String(n)).length < 2 ? "0" + n : n;
    }
}
